home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / float.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  6.3 KB  |  208 lines

  1. /*  float.h
  2.  
  3.     Defines implementation specific macros for dealing with
  4.     floating point.
  5.  
  6. */
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 9.0
  10.  *
  11.  *      Copyright (c) 1987, 1998 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15. /* $Revision:   9.5  $ */
  16.  
  17. #ifndef __FLOAT_H
  18. #define __FLOAT_H
  19.  
  20. #ifndef ___STDDEF_H
  21. #include <_stddef.h>
  22. #endif
  23.  
  24. #ifdef __cplusplus
  25. namespace std {
  26. #endif /* __cplusplus */
  27.  
  28.  
  29. #if !defined(RC_INVOKED)
  30.  
  31. #if defined(__STDC__)
  32. #pragma warn -nak
  33. #endif
  34.  
  35. #endif  /* !RC_INVOKED */
  36.  
  37.  
  38. #define FLT_RADIX           2
  39. #define FLT_ROUNDS          1
  40. #define FLT_GUARD           1
  41. #define FLT_NORMALIZE       1
  42.  
  43. #define DBL_DIG             15
  44. #define FLT_DIG             6
  45. #define LDBL_DIG            18
  46.  
  47. #define DBL_MANT_DIG        53
  48. #define FLT_MANT_DIG        24
  49. #define LDBL_MANT_DIG       64
  50.  
  51. #define DBL_EPSILON         2.2204460492503131E-16
  52. #define FLT_EPSILON         1.19209290E-07F
  53. #define LDBL_EPSILON        1.084202172485504434e-019L
  54.  
  55. /* smallest positive IEEE normal numbers */
  56. #define DBL_MIN             2.2250738585072014E-308
  57. #define FLT_MIN             1.17549435E-38F
  58. #define LDBL_MIN            _tiny_ldble
  59.  
  60. #define DBL_MAX             _max_dble
  61. #define FLT_MAX             _max_flt
  62. #define LDBL_MAX            _max_ldble
  63.  
  64. #define DBL_MAX_EXP         +1024
  65. #define FLT_MAX_EXP         +128
  66. #define LDBL_MAX_EXP        +16384
  67.  
  68. #define DBL_MAX_10_EXP      +308
  69. #define FLT_MAX_10_EXP      +38
  70. #define LDBL_MAX_10_EXP     +4932
  71.  
  72. #define DBL_MIN_10_EXP      -307
  73. #define FLT_MIN_10_EXP      -37
  74. #define LDBL_MIN_10_EXP     -4931
  75.  
  76. #define DBL_MIN_EXP         -1021
  77. #define FLT_MIN_EXP         -125
  78. #define LDBL_MIN_EXP        -16381
  79.  
  80. #ifdef __cplusplus
  81. extern "C" {
  82. #endif
  83.  
  84. extern float        _RTLENTRY _EXPDATA _max_flt;
  85. extern double       _RTLENTRY _EXPDATA _max_dble;
  86. extern long double  _RTLENTRY _EXPDATA _max_ldble;
  87. extern long double  _RTLENTRY _EXPDATA _tiny_ldble;
  88.  
  89. unsigned int _RTLENTRY          _clear87(void);
  90. unsigned int _RTLENTRY          _control87(unsigned int __newcw, unsigned int __mask);
  91. void         _RTLENTRY          _fpreset(void);
  92. unsigned int _RTLENTRY          _status87(void);
  93. int          _RTLENTRY          _isnan (double __d);
  94. int          _RTLENTRY          _isnanl (long double __ld);
  95. int          _RTLENTRY          _finite (double __d);
  96. int          _RTLENTRY          _finitel (long double __ld);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100.  
  101. #if !defined(__STDC__)
  102.  
  103. /* 387 Status Word format   */
  104.  
  105. #define SW_INVALID      0x0001  /* Invalid operation            */
  106. #define SW_DENORMAL     0x0002  /* Denormalized operand         */
  107. #define SW_ZERODIVIDE   0x0004  /* Zero divide                  */
  108. #define SW_OVERFLOW     0x0008  /* Overflow                     */
  109. #define SW_UNDERFLOW    0x0010  /* Underflow                    */
  110. #define SW_INEXACT      0x0020  /* Precision (Inexact result)   */
  111. #define SW_STACKFAULT   0x0040  /* Stack fault                  */
  112.  
  113. /* 387 Control Word format */
  114.  
  115. #define MCW_EM              0x003f  /* interrupt Exception Masks*/
  116. #define     EM_INVALID      0x0001  /*   invalid                */
  117. #define     EM_DENORMAL     0x0002  /*   denormal               */
  118. #define     EM_ZERODIVIDE   0x0004  /*   zero divide            */
  119. #define     EM_OVERFLOW     0x0008  /*   overflow               */
  120. #define     EM_UNDERFLOW    0x0010  /*   underflow              */
  121. #define     EM_INEXACT      0x0020  /*   inexact (precision)    */
  122.  
  123. #define MCW_IC              0x1000  /* Infinity Control */
  124. #define     IC_AFFINE       0x1000  /*   affine         */
  125. #define     IC_PROJECTIVE   0x0000  /*   projective     */
  126.  
  127. #define MCW_RC          0x0c00  /* Rounding Control     */
  128. #define     RC_CHOP     0x0c00  /*   chop               */
  129. #define     RC_UP       0x0800  /*   up                 */
  130. #define     RC_DOWN     0x0400  /*   down               */
  131. #define     RC_NEAR     0x0000  /*   near               */
  132.  
  133. #define MCW_PC          0x0300  /* Precision Control    */
  134. #define     PC_24       0x0000  /*    24 bits           */
  135. #define     PC_53       0x0200  /*    53 bits           */
  136. #define     PC_64       0x0300  /*    64 bits           */
  137.  
  138. /* 387 Initial Control Word */
  139. /* use affine infinity, mask underflow and precision exceptions */
  140.  
  141. #define CW_DEFAULT  _default87
  142. extern unsigned int _RTLENTRY _default87;
  143.  
  144. /*
  145.     SIGFPE signal error types (for integer & float exceptions).
  146. */
  147. #define FPE_INTOVFLOW       126 /* 80x86 Interrupt on overflow  */
  148. #define FPE_INTDIV0         127 /* 80x86 Integer divide by zero */
  149.  
  150. #define FPE_INVALID         129 /* 80x87 invalid operation      */
  151. #define FPE_ZERODIVIDE      131 /* 80x87 divide by zero         */
  152. #define FPE_OVERFLOW        132 /* 80x87 arithmetic overflow    */
  153. #define FPE_UNDERFLOW       133 /* 80x87 arithmetic underflow   */
  154. #define FPE_INEXACT         134 /* 80x87 precision loss         */
  155. #define FPE_STACKFAULT      135 /* 80x87 stack overflow         */
  156. #define FPE_EXPLICITGEN     140 /* When SIGFPE is raise()'d     */
  157.  
  158. /*
  159.             SIGSEGV signal error types.
  160. */
  161. #define SEGV_BOUND          10  /* A BOUND violation (SIGSEGV)  */
  162. #define SEGV_EXPLICITGEN    11  /* When SIGSEGV is raise()'d    */
  163. #define SEGV_ACCESS         12  /* Access violation */
  164. #define SEGV_STACK          13  /* Unable to grow stack */
  165.  
  166. /*
  167.             SIGILL signal error types.
  168. */
  169. #define ILL_EXECUTION       20  /* Illegal operation exception  */
  170. #define ILL_EXPLICITGEN     21  /* When SIGILL is raise()'d     */
  171. #define ILL_PRIVILEGED      22  /* Privileged instruction */
  172.  
  173. #endif  /* !__STDC__ */
  174.  
  175.  
  176. #if !defined(RC_INVOKED)
  177.  
  178. #if defined(__STDC__)
  179. #pragma warn .nak
  180. #endif
  181.  
  182. #endif  /* !RC_INVOKED */
  183.  
  184. #ifdef __cplusplus
  185. } // std
  186. #endif /* __cplusplus */
  187.  
  188. #endif  /* __FLOAT_H */
  189.  
  190. #if defined(__cplusplus) && !defined(__USING_CNAME__) && !defined(__FLOAT_H_USING_LIST)
  191. #define __FLOAT_H_USING_LIST
  192.      using std::_max_flt;
  193.      using std::_max_dble;
  194.      using std::_max_ldble;
  195.      using std::_tiny_ldble;
  196.      using std::_clear87;
  197.      using std::_control87;
  198.      using std::_fpreset;
  199.      using std::_status87;
  200.      using std::_isnan;
  201.      using std::_isnanl;
  202.      using std::_finite;
  203.      using std::_finitel;
  204. #if !defined(__STDC__)  /*  NON-ANSI  */
  205.      using std::_default87;
  206. #endif
  207. #endif /* __USING_CNAME__ */
  208.